--
-- Author: yawei.zhu
-- Date: 2018-09-21 11:17:58
--
-- PvpChampionNoticeView
--

local fileName = string.getModeName(...)
local ClassRef = class(fileName, app.mvc.ViewBase)

ClassRef.VIEW_ROOT_RES = Res.PvpChampionNoticeScene

function ClassRef:init()
	self._ui.tlt:setString(L("champion_notice5"))

	self._ui.Button_queding:addClickEventListener(function()
		if self._btnName:getString() == L("challengeTips3") then
			executeFunc(self._onOperate, "openChampionTeamView")
		else
			executeFunc(self._onOperate, "openChampionView")
		end
		self:closeView()
	end)
	self._ui.Button_quxiao:addClickEventListener(function()
		self:closeView()
	end)

	self._btnName = self._ui.Button_queding:getChildByName("name")
end

function ClassRef:updateView(param)
	if param == nil then param = 1 end

	local day = app:getWeekDay()
	local config = GD:queryThroneByDay(day)
	if not config then return end

	self._ui["Panel/map"]:loadTexture(string.format(Res.districtMapPath, config.district_map))

	local str = string.format("%s (%s)" , L(config.name), L(config.des) )
	self._ui.tips:setString(str)
	display.setNodesMiddle(self._ui.Panel, self._ui.tips_img, self._ui.tips)


	-- 通知匹配成功
	if param == 2 then 
		self._ui.tips_3:setString(L("challengeTips1"))		
		self._ui.tips_1:setString(L("challengeTips2"))
		self._btnName:setString(L("challengeTips3"))
	else
		self._ui.tips_3:setString(L("champion_register2"))
		self._ui.tips_1:setString(L("champion_notice6"))
		self._btnName:setString(L("challengeTips4"))
	end

	self._ui.tips_text:setString(L("challengeTips5"))
	display.setNodesMiddle(self._ui.Panel_tips, nil, self._ui.tips_text, self._ui.icon_bg)
end

return ClassRef
